<template>
  <div class="demo">
    <template>
      <div v-if="mode === 'edit'">
        <div v-if="!iconName">图标</div>
        <div v-else>
          <i
            :class="iconName"
          ></i>
        </div>
      </div>
      <div v-else>{{ value }}</div>
    </template>
  </div>
</template>

<script>
export default {
  name: "icon",
  components: {},
  props: {
    value: {},
    mode: {
      default: "edit", // 编辑模式和 edit， 展示模式 view
    },
    readonly: {
      type: Boolean,
      default: false,
    },
    disabled: {
      type: Boolean,
      default: false,
    },
    iconName: {
      default: "",
    },
  
  },
  data() {
    return {
      iconName: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    if (this.value) {
      this.iconName = this.value;
      if (this.mode == "view") {
        this.disabled = true;
      }
    }
  },
  methods: {},
};
</script>
<style lang="scss" scoped>
.demo {
  width: 100%;
  .van-cell {
    padding: 0;
  }
}
</style>
